//
//  VisitorController.swift
//  weiboSwift1.0
//
//  Created by xuNick on 16/4/16.
//  Copyright © 2016年 NN. All rights reserved.
//

import UIKit

class VisitorController: UITableViewController , VisitorViewDelegate {

    var login: Bool = UserAccountViewModel.shareUserAccountViewModel.isLogin
    
    
    
    override func loadView() {
        
        
        login ? super.loadView() : setupVisitorView()

    }
    
    
    
    private func setupVisitorView(){
        view = visitorView
        visitorView.delegate = self
        
        
        self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "clickRegisterButton")
        
        self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: "clickLoginButton")

    }
    
    // MARK: - 懒加载控件
    lazy var visitorView: HMVisitorView = HMVisitorView()
    
    
    func clickRegisterButton(){
        
    }
    
    func clickLoginButton(){
        
    }
    
    // MARK: - 实现协议里面的方法
    func loginButtonClick() {
        //model 出 oauthercontroller
    
        let autherVc = OauthViewController()
        self.presentViewController(UINavigationController(rootViewController: autherVc), animated: true, completion: nil)
    }
    
    func registerButtonClick() {
        print("点击了注册按钮")
        }
    
    

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    // MARK: - Table view data source

 


}
